<include file="Public:head" />
<div class="col-xs-12">
    <div class="tabbable">
        <ul class="nav nav-tabs padding-12 tab-color-blue background-blue" id="myTab">
            <li> <a href="{:U('Admin/Guide/index')}">引导图列表</a> </li>
			<li class="active"> <a href="{:U('Admin/Guide/addguide')}"><if condition="I('get.id')">修改<else/>添加</if>引导图</a> </li>
        </ul>
        <div class="tab-content">
            <form class="layui-form" action="{:U('Admin/Guide/saveguide')}">
            	<div class="layui-form-item">
				    <label class="layui-form-label">图片</label>
				    <div class="layui-input-inline">
				    	<input type="text" name="url" value="{$list.url}" required  lay-verify="required" placeholder="请输入图片地址" autocomplete="off" class="layui-input" id="guideUrl">
				    </div>
				    <a class="layui-btn layui-btn-normal layui-btn-small" style="margin-top:4px;" href="#" onclick="get_uploadify(1,'guideUrl','Guide','')">添加图片</a>
				    <a class="layui-btn layui-btn-normal layui-btn-small" style="margin-top:4px;" href="#" onclick="img_view('guideUrl')">预览</a>
				    <div class="layui-form-mid layui-word-aux"></div>
				</div>
				<div class="layui-form-item">
				    <label class="layui-form-label">状态</label>
				    <div class="layui-input-inline">
				    	<input type="radio" name="status" value="1" title="正常" <if condition="$list['status'] eq 1 || $list['status'] eq ''">checked</if>>
				    	<input type="radio" name="status" value="0" title="禁用" <eq name="list.status" value="0">checked</eq>>
				    </div>
				</div>
				<div class="layui-form-item">
				    <label class="layui-form-label">排序</label>
				    <div class="layui-input-inline">
				    	<input type="text" name="sort" value="<empty name="list.sort">50<else/>{$list.sort}</empty>" required  lay-verify="required" placeholder="50" autocomplete="off" class="layui-input">
				    </div>
				</div>
				<div class="layui-form-item">
				    <div class="layui-input-block">
				    	<button class="layui-btn" lay-submit lay-filter="saveGuide">立即提交</button>
				    	<button type="reset" class="layui-btn layui-btn-primary">重置</button>
				    </div>
				</div>
            </form>
        </div>
    </div>
</div>
<script type="text/javascript">
	$(function(){
		layui.use('form', function(){
			var form = layui.form;
			form.verify({
				// sort:[/^[1-9]*[1-9][0-9]*$/,"请输入排序的数字，数字越大，排序越靠前！"]
			});      
			//监听提交
			form.on('submit(saveGuide)', function(data){
				$(data.form).ajaxSubmit({
					url:"{:U('Admin/Guide/saveguide')}",
					type: 'post',
					beforeSubmit:function(ormData,jqForm,options){
						//加载层-风格4
						layer.msg('加载中...', {
						  icon: 16,
						  shade: 0.2,
						  time:0,
						});
					},
					success:function(responseText,statusText){
						layer.closeAll();
						if(responseText.status == 1){
							layer.msg(responseText.info, {icon: 6,shade: 0.2,time:1000},function(){
								location.href = responseText.url;
							});
						}else{
							layer.msg(responseText.info, {icon: 5,shade: 0.2,time:1000});
						}
					},
				});
				return false;
			});
		});

	});

</script>
<include file="Public:foot" />